<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSnappedTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('snapped', function (Blueprint $table) {

            $table->bigIncrements('id');

            $table->timestamps();

            $table->integer('goods_id')->unsigned()->comment('商品id');

            $table->integer('sku_type')->unsigned()->comment('规格类型,1全规格，2自定义规格');

            $table->integer('snapped_type')->unsigned()->comment('全局秒杀类型，1是价格，2是折扣');

            $table->decimal('price')->unsigned()->comment('全局秒杀价格');

            $table->decimal('percent')->unsigned()->comment('全局折扣(单位折)');

            $table->integer('cycle')->unsigned()->comment('周期，1一次，2每天，3每周，4每月');

            $table->integer('start_time')->unsigned()->comment('1次，开始时间');

            $table->integer('end_time')->unsigned()->comment('1次，结束时间');

            $table->integer('every_day_start_time')->unsigned()->comment('每天，开始时间');

            $table->integer('every_day_end_time')->unsigned()->comment('每天，结束时间');

            $table->string('week_time')->comment('每周，多个已逗号分隔');

            $table->string('date_time')->comment('每月，多个已逗号分隔');


        });

        DB::statement("ALTER TABLE `snapped` COMMENT='秒杀表'");//表注释


    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('snapped');
    }
}
